# Haystack Tutorials

<p align="center" float="left">
  <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/deepset-logo-colored.png" width="30%"/>
  <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored-on-dark.png#gh-dark-mode-only" width="30%"/>
  <img alt="" src="https://raw.githubusercontent.com/deepset-ai/.github/main/haystack-logo-colored.png#gh-light-mode-only" width="30%"/>
</p>

<strong><a href="https://github.com/deepset-ai/haystack">Haystack</a></strong> is an open source LLM framework by <strong><a href="https://deepset.ai">deepset</a></strong> to help you build production ready applications. Haystack is designed to help you build systems that work intelligently over large document collections to perform tasks like document retrieval, text generation, question answering, or summarization. It achieves this with the concept of <strong>Pipelines</strong> consisting of various <strong>Components</strong> such as a <strong>DocumentStore</strong>, a <strong>Retriever</strong>, and a <strong>PromptNode</strong>.

This is the repository where we keep all the Haystack tutorials 📓 👇 These tutorials are also published to the [Haystack Website](https://haystack.deepset.ai/tutorials/).

To contribute to the tutorials, please check out our [Contributing Guidelines](./Contributing.md).

[![Run Tutorials Nightly](https://github.com/deepset-ai/haystack-tutorials/actions/workflows/nightly.yml/badge.svg)](https://github.com/deepset-ai/haystack-tutorials/actions/workflows/nightly.yml)
[![Publish tutorials on Haystack Home](https://github.com/deepset-ai/haystack-tutorials/actions/workflows/publish_tutorials.yml/badge.svg)](https://github.com/deepset-ai/haystack-tutorials/actions/workflows/publish_tutorials.yml)

## Tutorials

<table>
<tr>
<th align="center">
<img width="465px">
<p> 
Haystack 1.x
</p>
</th>
<th align="center">
<img width="535px">
<p> 
Haystack 2.0
</p>
</th>
</tr>
</table>

| Code                                                                                                      | Colab                                                                                                                                                                                                                                     | Code                                                                                                             | Colab                                                                                                                                                                                                                    |
| :-------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Build Your First Question Answering System](./tutorials/01_Basic_QA_Pipeline.ipynb)                      | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/01_Basic_QA_Pipeline.ipynb)                                       | [Your First QA Pipeline with Retrieval-Augmentation](./tutorials/27_First_RAG_Pipeline.ipynb)                    | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/27_First_RAG_Pipeline.ipynb)                     |
| [Fine Tune a Model on Your Data](./tutorials/02_Finetune_a_model_on_your_data.ipynb)                      | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/02_Finetune_a_model_on_your_data.ipynb)                           | [Generating Structured Output with Loop-Based Auto-Correction](./tutorials/28_Structured_Output_With_Loop.ipynb) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/28_Structured_Output_With_Loop.ipynb)            |
| [Build a Scalable Question Answering System](./tutorials/03_Scalable_QA_System.ipynb)                     | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/03_Scalable_QA_System.ipynb)                                      | [Serializing Pipelines](./tutorials/29_Serializing_Pipelines.ipynb)                                              | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/29_Serializing_Pipelines.ipynb)                  |
| [FAQ Style QA](./tutorials/04_FAQ_style_QA.ipynb)                                                         | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/04_FAQ_style_QA.ipynb)                                            | [Preprocessing Different File Types](./tutorials/30_File_Type_Preprocessing_Index_Pipeline.ipynb)                | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/30_File_Type_Preprocessing_Index_Pipeline.ipynb) |
| [Evaluation](./tutorials/05_Evaluation.ipynb)                                                             | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/05_Evaluation.ipynb)                                              | [Metadata Filtering](./tutorials/31_Metadata_Filtering.ipynb)                                                    | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/31_Metadata_Filtering.ipynb)                     |
| [Better Retrieval via Embedding Retrieval](./tutorials/06_Better_Retrieval_via_Embedding_Retrieval.ipynb) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/06_Better_Retrieval_via_Embedding_Retrieval.ipynb)                | [Classifying Documents & Queries by Language](./tutorials/32_Classifying_Documents_and_Queries_by_Language.ipynb)| [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/32_Classifying_Documents_and_Queries_by_Language.ipynb)|
| [[OUTDATED] RAG Generator](./tutorials/07_RAG_Generator.ipynb)                                            | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/07_RAG_Generator.ipynb)                                           | [Creating a Hybrid Retrieval Pipeline](./tutorials/33_Hybrid_Retrieval.ipynb)                                    | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/33_Hybrid_Retrieval.ipynb)                       |
| [Preprocessing](./tutorials/08_Preprocessing.ipynb)                                                       | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/08_Preprocessing.ipynb)                                           | [Build an Extractive QA Pipeline](./tutorials/34_Extractive_QA_Pipeline.ipynb)                                   | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/34_Extractive_QA_Pipeline.ipynb)                 |
| [DPR Training](./tutorials/09_DPR_training.ipynb)                                                         | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/09_DPR_training.ipynb)                                            | [Model-Based Evaluation of RAG Pipelines](./tutorials/35_Model_Based_Evaluation_of_RAG_Pipelines.ipynb)          | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/35_Model_Based_Evaluation_of_RAG_Pipelines.ipynb)|
| [[OUTDATED] Knowledge Graph](./tutorials/10_Knowledge_Graph.ipynb)                                        | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/10_Knowledge_Graph.ipynb)                                         | [Building Pipelines with Conditional Routing](./tutorials/36_Building_Fallbacks_with_Conditional_Routing.ipynb)  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/36_Building_Fallbacks_with_Conditional_Routing.ipynb)|
| [Pipelines](./tutorials/11_Pipelines.ipynb)                                                               | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/11_Pipelines.ipynb)                                               | [Simplifying Pipeline Inputs with Multiplexer](./tutorials/37_Simplifying_Pipeline_Inputs_with_Multiplexer.ipynb)| [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/37_Simplifying_Pipeline_Inputs_with_Multiplexer.ipynb)|
| [[OUTDATED] Seq2SeqGenerator](./tutorials/12_LFQA.ipynb)                                                  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/12_LFQA.ipynb)                                                    | [Embedding Metadata for Improved Retrieval](./tutorials/39_Embedding_Metadata_for_Improved_Retrieval.ipynb)      | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/39_Embedding_Metadata_for_Improved_Retrieval.ipynb)|
| [Question Generation](./tutorials/13_Question_generation.ipynb)                                           | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/13_Question_generation.ipynb)                                     | [Building a Chat Application with Function Calling](./tutorials/40_Building_Chat_Application_with_Function_Calling.ipynb)| [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/40_Building_Chat_Application_with_Function_Calling.ipynb)|
| [Query Classifier](./tutorials/14_Query_Classifier.ipynb)                                                 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/14_Query_Classifier.ipynb)                                        |                                                                                                                  |                                                                                                                                                                                                                          |
| [Table QA](./tutorials/15_TableQA.ipynb)                                                                  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/15_TableQA.ipynb)                                                 |                                                                                                                  |                                                                                                                                                                                                                          |
| [Document Classifier at Index Time](./tutorials/16_Document_Classifier_at_Index_Time.ipynb)               | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/16_Document_Classifier_at_Index_Time.ipynb)                       |                                                                                                                  |                                                                                                                                                                                                                          |
| [Make Your QA Pipelines Talk!](./tutorials/17_Audio.ipynb)                                                | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/17_Audio.ipynb)                                                   |                                                                                                                  |                                                                                                                                                                                                                          |
| [Generative Pseudo Labeling](./tutorials/18_GPL.ipynb)                                                    | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/18_GPL.ipynb)                                                     |                                                                                                                  |                                                                                                                                                                                                                          |
| [Text-to-Image search](./tutorials/19_Text_to_Image_search_pipeline_with_MultiModal_Retriever.ipynb)      | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/19_Text_to_Image_search_pipeline_with_MultiModal_Retriever.ipynb) |                                                                                                                  |                                                                                                                                                                                                                          |
| [Using Haystack with REST API](./tutorials/20_Using_Haystack_with_REST_API.ipynb)                         | <a href="https://haystack.deepset.ai/downloads/20_Using_Haystack_with_REST_API.ipynb" target="_blank"><img alt="Download" src="https://img.shields.io/badge/DOWNLOAD-blue?&style=for-the-badge"/> <a>                                     |                                                                                                                  |                                                                                                                                                                                                                          |
| [Customizing PromptNode](./tutorials/21_Customizing_PromptNode.ipynb)                                     | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/21_Customizing_PromptNode.ipynb)                                  |                                                                                                                  |                                                                                                                                                                                                                          |
| [Generative QA Pipeline with Retrieval-Augmentation](./tutorials/22_Pipeline_with_PromptNode.ipynb)       | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/22_Pipeline_with_PromptNode.ipynb)                                |                                                                                                                  |                                                                                                                                                                                                                          |
| [Answering Complex Questions with Agents](./tutorials/23_Answering_Multihop_Questions_with_Agents.ipynb)  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/23_Answering_Multihop_Questions_with_Agents.ipynb)                |                                                                                                                  |                                                                                                                                                                                                                          |
| [Building a Conversational Chat App](./tutorials/24_Building_Chat_App.ipynb)                              | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/24_Building_Chat_App.ipynb)                                       |                                                                                                                  |                                                                                                                                                                                                                          |
| [Customizing Agent to Chat with Your Documents](./tutorials/25_Customizing_Agent.ipynb)                   | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/25_Customizing_Agent.ipynb)                                       |                                                                                                                  |                                                                                                                                                                                                                          |
| [Creating a Hybrid Retrieval Pipeline](./tutorials/26_Hybrid_Retrieval.ipynb)                             | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack-tutorials/blob/main/tutorials/26_Hybrid_Retrieval.ipynb)                                        |                                                                                                                  |                                                                                                                                                                                                                          |
